<?php

use yii\helpers\Html;
use yii\widgets\DetailView;
// use app\models\News;
/* @var $this yii\web\View */
/* @var $model app\models\News */

$this->title = Yii::t('app', '应用详情');
$this->params['breadcrumbs'][] = ['label' => Yii::t('app', '应用列表'), 'url' => ['index']];
$this->params['breadcrumbs'][] = $this->title;
?>
<div class="news-view box box-primary">
    <div class="box-header">
        <div class="btn-group">
          <a class="btn btn-primary check-status" project-id="<?=$model->id?>"><i class="icon-user icon-white"></i> <?=\Yii::t('app', '审核')?></a>
          
        </div>
    </div>
    <div class="box-body table-responsive no-padding">
        <?= DetailView::widget([
            'model' => $model,
            'attributes' => [
                'id',
                'name',
                // 'author',
                'email:email',
                'big_cate',
                'brief_desc:html',
                'desc:html',
                [
                    'attribute'=>'logo_url',
                    'format'=>'raw',
                    'value'=>function($model){
                        return $model->getPictrue($model->logo_url);
                    }
                ],
                [
                    'attribute'=>'photo',
                    'format'=>'raw',
                    'value'=>function($model){
                        return $model->getPictrues($model->photo);
                    }
                ],
                [  
                    'attribute'=>'status',
                    'format'=> 'html',
                    'value' => function($model){
                        return $model::getCheckStatus($model->status);
                    }
                ],
                
                [   
                    'attribute'=>'created_time',
                    'format' => ['date', "php:Y-m-d H:i:s"],
                ],
                [   
                    'captionOptions' => ['style' =>'color:blue'],
                    'attribute'=>'opt_note',
                    'format' => 'ntext',
                ],
                // [
                //     'attribute'=>'updated_time',
                //     'format' => ['date', "php:Y-m-d H:i:s"],
                // ],

            ],
        ]) ?>
    </div>
</div>

<?php //按需注入js, 放在</body>前面
$this->registerJs("
        $(document).on('click', '.check-status', function(event) {
            var id = $(this).attr('project-id');
            var url = '/app/check?id='+id;
            layer.open({
                type: 2,
                anim: 0,
                shade: [0.3, '#393D49'],
                // skin: 'layui-layer-molv',
                title: '审核项目',
                skin: 'layui-layer-rim', //加上边框
                area: ['1200', '400px'], //自定义文本域宽高
                content: url //注意，如果str是object，那么需要字符拼接。
              });
        })
    ", 
    \yii\web\View::POS_END);
 ?>

